8b4d5f0f98d546b7fed693090700ea5a03d70d7c,components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java,RestletSetBodyTest,consumerShouldReturnInputStream,#,96

Before Change


            assertEquals("video/mp4", response.getEntity().getContentType().getValue());
            assertTrue("Content should be streamed", response.getEntity().isChunked());
            assertEquals("Content length should be unknown", -1, response.getEntity().getContentLength());
            is = response.getEntity().getContent();
            byte[] buffer = new byte[256];
            assumeThat("Should read all data", is.read(buffer), equalTo(256));
            assertThat("Binary content should match", buffer, equalTo(getAllBytes()));
        } finally {
            httpclient.close();

After Change


            assertEquals("Content length should be unknown", -1, response.getEntity().getContentLength());
            try (InputStream is = response.getEntity().getContent()) {
                byte[] buffer = new byte[256];
                assumeThat("Should read all data", is.read(buffer), equalTo(256));
                assertThat("Binary content should match", buffer, equalTo(getAllBytes()));
            }
        }